import request from '@/utils/request';
import { AxiosPromise } from 'axios';
import { SkQuestionBankVO, SkQuestionBankForm, SkQuestionBankQuery } from '@/api/app/SkQuestionBank/types';

/**
 * 查询题库信息列表
 * @param query
 * @returns {*}
 */

export const listSkQuestionBank = (query?: SkQuestionBankQuery): AxiosPromise<SkQuestionBankVO[]> => {
  return request({
    url: '/app/SkQuestionBank/list',
    method: 'get',
    params: query
  });
};

/**
 * 查询题库信息详细
 * @param id
 */
export const getSkQuestionBank = (id: string | number): AxiosPromise<SkQuestionBankVO> => {
  return request({
    url: '/app/SkQuestionBank/' + id,
    method: 'get'
  });
};

/**
 * 新增题库信息
 * @param data
 */
export const addSkQuestionBank = (data: SkQuestionBankForm) => {
  return request({
    url: '/app/SkQuestionBank',
    method: 'post',
    data: data
  });
};

/**
 * 修改题库信息
 * @param data
 */
export const updateSkQuestionBank = (data: SkQuestionBankForm) => {
  return request({
    url: '/app/SkQuestionBank',
    method: 'put',
    data: data
  });
};

/**
 * 删除题库信息
 * @param id
 */
export const delSkQuestionBank = (id: string | number | Array<string | number>) => {
  return request({
    url: '/app/SkQuestionBank/' + id,
    method: 'delete'
  });
};
